package com.example.zhc36.fragment.dao;

import com.example.zhc36.fragment.bean.javabean;
import com.example.zhc36.fragment.bean.userbean;


import java.util.List;

import io.realm.Realm;
import io.realm.RealmResults;

public class mainmsgDao {



    public  void  insert (List<userbean> userbean){
        Realm realm = Realm.getDefaultInstance();
        realm.beginTransaction();
        realm.insertOrUpdate(userbean);
        realm.commitTransaction();
        realm.close();


    }

    public  List<userbean>  show(){
        Realm realm = Realm.getDefaultInstance();
        RealmResults<userbean> all = realm.where(userbean.class).findAll();
        List<userbean> userbeans = realm.copyFromRealm(all);

        realm.close();
        return userbeans;


    }

}
